package com.explorer.ider.bootguide.utils;

import android.app.AlarmManager;

import java.util.TimeZone;

/**
 * Created by Eric on 2016/9/6.
 */
public class TimeZoneUtils {

    private static final String TAG = "TimeZoneUtils";
    private AlarmManager mAlarmManager;
    private TimeZone javaTimeZone;


    public TimeZoneUtils(AlarmManager mAlarmManager){
        this.mAlarmManager = mAlarmManager;
    }

    public void setTimeZone(String timeZone){
        mAlarmManager.setTimeZone(timeZone);
    }

//    /**
//     * TimeInfo.mAreaName = 地区名
//     * TimeInfo.mSummerTime = GTM+ --
//     * TimeInfo.mTimeID = setTimeZone(传入的参数)
//     * @return
//     */
//    public List<TimeInfo> getTimeZoneList(){
//        String[] mTimeZoneID = TimeZone.getAvailableIDs();
//        TimeZone[] javaTimeZone = new TimeZone[mTimeZoneID.length];
//        List<TimeInfo> mTimeInfoList = new ArrayList<>();
//        TimeInfo mTimeInfo= new TimeInfo();
//        int j = 0;
//        for (int i = 0; i < mTimeZoneID.length; i++) {
//                javaTimeZone[i] = TimeZone.getTimeZone(mTimeZoneID[i]);
//            if (
//                     javaTimeZone[i].getID().indexOf("/") != -1) {
//                mTimeInfo.loadingInfo(javaTimeZone[i]);
//                mTimeInfoList.add(mTimeInfo);
//                Log.i(TAG, "getTimeZoneList: " + mTimeInfoList.get(j).getmSummerTime() + mTimeInfoList.get(j).getmTimeID() + mTimeInfoList.get(j).getmAreaName());
//                j++;
//            }
//        }
//
//        return mTimeInfoList;
//    }
    /**
     * 返回一个二维数组[时差][地区id]
     * 获取地区名字使用getTimeZoneName，传入二维数组的ID
     * @return
     */
    public String[][] getTimeZoneList(){
        return TIME_TYPE;
    }

    /**
     * 传入ID获取地区国际化名字
     * @param timeID
     * @return
     */
    public String getTimeZoneName(String timeID){
        javaTimeZone = TimeZone.getTimeZone(timeID);
        return javaTimeZone.getDisplayName();
    }

    public static final String[][] TIME_TYPE = new String[][]{
            {"GTM-03:00","America/Sao_Paulo"},
            {"GTM-11:00","Pacific/Midway"},
            {"GTM-10:00","Pacific/Honolulu"},
            {"GTM-08:00","America/Los_Angeles"},
            {"GTM-07:00","America/Phoenix"},
            {"GTM-06:00","America/Costa_Rica"},
            {"GTM-05:00","America/New_York"},
            {"GTM-04:00","America/Barbados"},
            {"GTM-03:00","America/St_Johns"},
            {"GTM-02:00","America/Montevideo"},
            {"GTM-01:00","Atlantic/Cape_Verde"},
            {"GTM+00:00","Europe/London"},
            {"GTM+01:00","Africa/Brazzaville"},
            {"GTM+02:00","Europe/Athens"},
            {"GTM+03:00","Europe/Moscow"},
            {"GTM+04:00","Asia/Dubai"},
            {"GTM+04:00","Asia/Dubai"},
            {"GTM+07:00","Asia/Bangkok"},
            {"GTM+08:00","Asia/Shanghai"},
            {"GTM+08:00","Asia/Hong_Kong"},
            {"GTM+08:00","Asia/Taipei"},
            {"GTM+09:00","Asia/Tokyo"},

    };

}



